<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<script>

    function aa(){
       alert("test");
    }

    var btn3  =  document.getElementById("btn3");

    btn3.onclick = function(){
        alert("btn click");
    }

    var btn4  =  document.getElementById("btn4");
    btn4.addEventListener('click',function(){
        alert(this.id);
    },false);

</script>
<body>
<input type="button" onclick="alert(this.value)" value="单击事件1">

<input type="button" onclick="aa()" value="单击事件2">

<input type="button" id="btn3" value="单击事件3">

<input type="button" id="btn4" value="单击事件4">
</body>
</html>
